{extend name="layout" /}

{block name="title"}<title>配置项列表 - {$Think.config.site.systemname}</title>{/block}

{block name="content"}
<style type="text/css">
.simple_form .radio { margin-top:10px}
</style>
<div class="g_6 contents_header">
    <h3 class="tab_label"><span class="icon icon-equalizer"></span> 配置项列表</h3>
    <div><span class="label">Option list</span></div>
</div>
<div class="g_6 contents_options">
    <div class="simple_buttons">
        <div class="btnIcon"><span class="icon icon-equalizer"> </span><a href="http://www.kancloud.cn/thinkblog/thinkblog/222144" target="_blank">帮助文档</a></div>
    </div>    
    <div class="simple_buttons">
   		<div class="btnIcon"><span class="icon icon-plus"> </span><a href="{:url('home/option/edit')}">添加配置项</a></div>
    </div>
</div>

<!-- Separator -->
<div class="g_12 separator"><span></span></div>
<!-- Table With Options on Header -->

<div class="g_12">
    <div class="widget_header wwOptions">
        <h4 class="widget_header_title"><span class="icon icon-equalizer"></span> 配置项列表</h4>        
    </div>
    <div class="widget_contents noPadding">
   		<form action="{:url('home/option/index')}" method="post" />
           <div class="line_grid" style="border-bottom:1px solid #dadada">                  
					<span class="label">配置项名称:</span>
                   <input type="text" name="o_name" value="{$o_name}" class="simple_field" style="width:350px"/>
                   <input type="submit" value="搜索" class="submitIt simple_buttons" />
           </div>           
        </form>
     	<form action="{:url('home/option/changeContent')}" method="post">
        <table class="datatable tables">
            <thead>
                <tr>
                    <th width="30">序号</th>
                    <th width="100">配置项</th>
                    <th>值</th>
                    <th width="140">操作管理</th>
                </tr>
            </thead>
            <tbody>
                {volist name="datalist" id="vo"}
                <tr id="id_{$vo.o_id}">
                    <td><input type="text" class="simple_field" name="o_order[]" value="{$vo.o_order}"  onchange="javascript:changeOrder(this,{$vo.o_id})"></td>
                    <td>{$vo.o_name}</td>
                    <td><input type="hidden" name="o_id[]" value="{$vo.o_id}">{$vo._html}</td>
                    <td>
                    	<div class="simple_buttons sbtnIcon">
                    	<a href="{:url('home/option/edit',['o_id'=>$vo.o_id])}"><span class="icon icon-pencil"> </span>编辑</a>
                    	</div>
                    	<div class="simple_buttons sbtnIcon">
                    	<a href="javascript:removeinfo({$vo.o_id});"><span class="icon icon-bin"> </span>删除</a>
                    	</div>
                    </td>
                </tr>
                {/volist}                
            </tbody>
        </table>        
    </div>
    <div class="widget_contents dtBottom" style="text-align:center">
                <input type="submit" value="保存信息" class="submitIt simple_buttons" />
    </div>
    </form>
</div>
<script type="text/javascript">
//删除分类
function removeinfo(id){
    layer.confirm('您确定要删除这条信息吗？',{
        btn:['确定','取消']
    },function(){            
        $.getJSON("{:url('home/option/removeinfo')}",{'o_id':id},function(data){
        	//console.log(data.status);
           if(data.status==0){
               layer.msg(data.msg,{icon:1});
               $("#id_"+id).empty();
           }else{
               layer.msg(data.msg,{icon:2});
           }
        });
    },function(){}
    );
}
//修改排序
function changeOrder(obj,id){
  var order = $(obj).val();
   $.getJSON("{:url('home/option/changeOrder')}",{'id':id,'order':order},function(data){
       if(data.status==0){
           layer.msg(data.msg,{icon:1});
       }else{
           layer.msg(data.msg,{icon:2});               
       }
   });
}
</script>
{/block}